package com.huishu.order.fegin;

import com.huishu.commons.pojo.Result;
import com.huishu.commons.pojo.dto.DeductionStockDTO;
import com.huishu.commons.pojo.vo.CartItemGoodsVO;
import com.huishu.commons.pojo.vo.FullReductionVO;
import com.huishu.order.fegin.fallback.GoodsFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @ClassName：GoodsFeignClient
 * @Author: ljj
 * @Date: 2023/4/11 9:30
 * @Description:
 */
@FeignClient(name = "goods-server", path = "/goods", fallbackFactory = GoodsFeignClientFallBack.class)
public interface GoodsFeignClient {

    /**
     * 查询满减活动
     * @param ids
     * @return
     */
    @PostMapping("/product-full-reduction/find")
    Result<List<FullReductionVO>> find(@RequestBody List<Long> ids);


    /**
     * 查询购物车里的商品根据ids
     * @param ids
     * @return
     */
    @PostMapping("/product/findCartItemGoods")
    Result<List<CartItemGoodsVO>> findCartItemGoods(@RequestBody List<Long> ids);

    /**
     * 扣减库存
     * @param deductionStocks
     * @return
     */
    @PostMapping("/product/deduction-stock")
    Result deductionStock(@RequestBody List<DeductionStockDTO> deductionStocks);

    /**
     * 根据id查询商品
     * @param productId
     * @return
     */
    @PostMapping("/product/findById/{productId}")
    Result findGoodsById(@PathVariable Long productId);
}
